<template>
	<view>
		<view class="item" v-for="(item,index) in logisticsList" :key='index'>
			<view class="top">{{item.createTime}}发货</view>
			<view class="content">
				<view class="order-num com">
					<span>订单编号：</span>
					<span class='num'>{{item.orderId}}</span>
				</view>
				<view class="out-num com" @click="outboundDetail">
					<span>出库编号：</span>
					<span class='num'>{{item.deliveryNo}}</span>
				</view>
				<view class="cour-com com">
					<span>快递公司：</span>
					<span class='num'>{{item.expressName}}</span>
				</view>
				<view class="logi-num">
					<view>
						<span>物流单号：</span>
						<span class='num'>{{item.expressNo}}</span>
					</view>
					<view class="copy" @click="copy(item.expressNo)">复制</view>
				</view>
			</view>
		</view>
		<view class="out-no" v-if="logisticsList.length==0">
			<view class="img">
				<image src="/static/image/noinfo.png" mode=""></image>
			</view>
			<view class="text-no">
				暂无物流信息
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				value: '27974901484047',
				id: 0,
				logisticsList: {}
			};
		},
		onLoad(options) {
			this.orderId = options.orderId
			this.getLogistics()
		},
		onShareAppMessage(options) {
			return {
				title: '上云丰花卉',
				path: '/pages/home/home'
			}
		},
		onShareTimeline(options) {
			return {
				title: '上云丰花卉',
				path: '/pages/home/home'
			}
		},
		methods: {
			// 物流接口
			getLogistics() {
				let self = this;
				self._get('user/order/get/express', {
					orderId: this.orderId
				}, res => {
					console.log(res, '235543');
					const {
						data
					} = res;
					self.logisticsList = data
				});


			},
			dateFormat(date) {
				const dt = new Date(date * 1000)
				const y = dt.getFullYear()
				const m = (dt.getMonth() + 1 + '').padStart(2, '0')
				const d = (dt.getDate() + '').padStart(2, '0')
				const hh = (dt.getHours() + '').padStart(2, '0')
				const mm = (dt.getMinutes() + '').padStart(2, '0')
				const ss = (dt.getSeconds() + '').padStart(2, '0')

				return `${y}-${m}-${d} `
			},
			// // 复制
			// copy(value){
			// 	//提示模板
			// 	uni.setClipboardData({
			// 		data: value, //要被复制的内容
			// 		success: function() {

			// 		},
			// 		fail: function(err) {

			// 		}
			// 	});
			// 	// uni.showModal({
			// 	// 	content: value, //模板中提示的内容
			// 	// 	confirmText: '复制内容',
			// 	// 	confirmColor:'#077840',
			// 	// 	success: () => {

			// 	// 	}
			// 	// });
			// },
			copy(value) {
				uni.setClipboardData({
					data: value, //要被复制的内容
					success: function() {
						// uni.showToast({
						//     title: '复制成功',
						//     duration: 2000,
						//     icon: 'none'
						// });
					}
				})
			},
			// 出库编号
			// outboundDetail(){
			// 	uni.navigateTo({
			// 		url:'../outboundRecords/outboundDetail/outboundDetail'
			// 	})
			// }
		}
	}
</script>
<style lang="less">
	page {
		background-color: #F9F9F9;
	}
</style>
<style lang="less" scoped>
	.item {
		width: 690rpx;
		height: 380rpx;
		margin: 0 auto;
		background: #FFFFFF;
		border-radius: 8rpx;
		margin-top: 20rpx;
		font-size: 28rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #999999;

		.top {
			width: 630rpx;
			height: 100rpx;
			line-height: 100rpx;
			margin: 0 auto;
			border-bottom: 2rpx solid #EEEEEE;
			color: #333333;
			margin-bottom: 30rpx;
		}

		.content {
			padding: 0 30rpx;
			box-sizing: border-box;

			.com {
				margin-bottom: 20rpx;
			}

			.num {
				color: #333;
			}

			.logi-num {
				display: flex;
				justify-content: space-between;
				margin-bottom: 24rpx;

				.copy {
					width: 88rpx;
					height: 54rpx;
					background: #077840;
					border-radius: 8rpx;
					color: #fff;
					line-height: 54rpx;
					text-align: center;
				}
			}
		}
	}

	.out-no {
		width: 168rpx;
		height: 172rpx;
		margin-top: 80rpx;
		margin-left: 292rpx;

		.img {
			width: 128rpx;
			height: 102rpx;
			margin-left: 20rpx;

			image {
				width: 100%;
				height: 100%;
			}
		}

		.text-no {
			margin-top: 30rpx;
			font-size: 28rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #999999;

		}
	}
</style>